package com.jianjian.Utils;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author Zsir
 * @create 2021-12-06 21:21
 */
public class SqlSessionFactoryUtil {
private static SqlSessionFactory sqlSessionFactory;
 static {
     try {
         InputStream inputStream = Resources.getResourceAsStream("mybatis_config.xml");
         sqlSessionFactory=new SqlSessionFactoryBuilder().build(inputStream);
     } catch (IOException e) {
         e.printStackTrace();
     }
 }
 public static SqlSessionFactory getSqlSessionFactory(){
     return sqlSessionFactory;
 }

}
